import { DisplayUtil } from "../../../../common/DisplayUtil";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { FontUtil } from "../../../../common/font/FontUtil";
import { SecTimerView } from "../../common/SecTimerView";
import { Language } from "../../../../../extend/language/Language";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
type int = number;
//class LGXBDescTopWin
    
    export  class LGXBDescTopWin /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.initView();
            return;
        }

        public updateWin(arg1: int, arg2: Array<any>, arg3: int, arg4: int=20): void
        {
            this._txtLeftTimes.htmlText = arg1.toString();
            if (arg1 >= arg4) 
            {
                this._txtTimsDesc.stop();
                DisplayUtil.removeMe(this._txtTimsDesc);
            }
            else 
            {
                this.addChild(this._txtTimsDesc);
                this._txtTimsDesc.setLeftTime(arg3, true);
            }
            this.updateRecentGotText(arg2);
            return;
        }

        public updateRecentGotText(arg1: Array<any>): void
        {
            if (arg1 == null || arg1.length == 0) 
            {
                return;
            }
            var loc1="";
            var loc2=0;
            while (loc2 < arg1.length) 
            {
                if (loc2 != 0) 
                {
                    loc1 = loc1 + (String(arg1[loc2]) + "\n");
                }
                else 
                {
                    loc1 = "<font color=\'#ffff00\'>" + String(arg1[loc2]) + "</font>\n";
                }
                ++loc2;
            }
            this._txtRollingTips.defaultTextFormat = this._tf;
            this._txtRollingTips.htmlText = loc1;
            return;
        }

        /* internal  */initView(): void
        {
            ObjCreate.createBg(0, 0, 699, 130, this);
            ObjCreate.createBitmap(ImagesConst.LGXB_TopBg, 1, 2, this);
            ObjCreate.createBitmap(ImagesConst.LGXB_leftTimes, 180, 15, this);
            ObjCreate.createBg(180, 40, 374, 1, this, ImagesConst.SplitLine);
            this._txtLeftTimes = ObjCreate.createGTextField("", 313, 15, 38, 32, this);
            var loc1=this._txtLeftTimes.defaultTextFormat;
            loc1.font = FontUtil.stXingkaiName;
            loc1.size = 20;
            loc1.color = 65280;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._txtLeftTimes.defaultTextFormat = loc1;
            this._txtLeftTimes.mouseWheelEnabled = false;
            this._txtLeftTimes.mouseEnabled = false;
            this._txtTimsDesc = new SecTimerView();
            this._txtTimsDesc.x = 390;
            this._txtTimsDesc.y = 18;
            this._txtTimsDesc.width = 220;
            this._txtTimsDesc.height = 20;
            this._txtTimsDesc.textColor = 65280;
            this._txtTimsDesc.setParse(Language.getString(80275));
            this._txtTimsDesc.setLeftTime(60);
            this._txtTimsDesc.timeOutHandler = this.nextPointTimerOut;
            this.addChild(this._txtTimsDesc);
            this._txtTimsDesc.mouseWheelEnabled = false;
            this._txtTimsDesc.mouseEnabled = false;
            this._txtRollingTips = ObjCreate.createGTextField("", 180, 44, 580, 80, this);
            loc1 = this._txtRollingTips.defaultTextFormat;
            loc1.leading = 8;
            this._txtRollingTips.defaultTextFormat = loc1;
            this._txtRollingTips.wordWrap = true;
            this._txtRollingTips.multiline = true;
            this._tf = this._txtRollingTips.defaultTextFormat;
            this._txtRollingTips.mouseWheelEnabled = false;
            this._txtRollingTips.mouseEnabled = false;
            return;
        }

        /* internal  */nextPointTimerOut(): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.LGXBGetNextPointTimerOut));
            return;
        }

        /* internal */ /* var */_txtLeftTimes: GTextFiled;

        /* internal */ /* var */_txtTimsDesc: SecTimerView;

        /* internal */ /* var */_txtRollingTips: GTextFiled;

        /* internal */ /* var */_tf: Object /* flash.text.TextFormat */;
    }
